using System;
using Beaker.OpenCube.Render.Maths;

namespace Beaker.OpenCube.Render.Materials
{
	public sealed class Checkerboard
		: Material
	{
		public Color Diffuse( Intersection intersection )
		{
			if( !( ( Math.Floor( intersection.HitPoint.Z ) + Math.Floor( intersection.HitPoint.X ) ) % 2d ).AboutZero() )
				return Color.White;
			return Color.Black;
		}

		public Color Specular( Intersection intersection )
		{
			return Color.White;
		}

		public double Reflect( Intersection intersection )
		{
			if( !( ( Math.Floor( intersection.HitPoint.Z ) + Math.Floor( intersection.HitPoint.X ) ) % 2d ).AboutZero() )
				return 0.1d;
			return 0.7d;
		}

		public double Roughness( Intersection intersection )
		{
			return 150d;
		}
	}
}